package com.p2p.auth.service.repository;

import com.p2p.auth.domain.entity.Visitor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Antinomy on 16/10/13.
 */

@Repository
public interface VisitorRepository extends JpaRepository<Visitor, Long> {

    Visitor findByVisitorPhoneNum(String visitorPhoneNum);


    List<Visitor> findByRoleId(String roleId);

    @Override
    Page<Visitor> findAll(Pageable pageable);

    Visitor findByUserId(String userId);

    /**
     * 根据条件分布查询
     * @param VisitorSpecification
     * @param page
     * @return
     */
    Page<Visitor> findAll(Specification<Visitor> VisitorSpecification, Pageable page);
}
